package com.news.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.news.dao.NewsCommentDao;
import com.news.entity.NewsComment;
import com.news.service.NewsCommentService;
@Service
public class NewsCommentServiceImpl implements NewsCommentService{
	@Autowired
	private NewsCommentDao newsCommentDao;
	public List<NewsComment> getCommentsByNewsId(int newsid) {		
		return newsCommentDao.getCommentsByNewsId(newsid);
	}
	
	@Transactional(propagation=Propagation.REQUIRED)
	public void addComment(NewsComment comment) {
		newsCommentDao.addComment(comment);
	}

	public int checkComment(int newsid, String content) {
		return newsCommentDao.checkComment(newsid, content);
	}
}
